﻿using CommunityToolkit.Mvvm.Messaging;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfByToolKit.ViewModel;

namespace WpfByToolKit
{
	/// <summary>
	/// Interaction logic for MainWindow.xaml
	/// </summary>
	public partial class MainWindow : Window
	{
		public MainWindow()
		{
			InitializeComponent();
			//this.DataContext = new MainWindowViewModel();
			//引入ioc 需要修改xaml
			this.DataContext = new Locator();


			WeakReferenceMessenger.Default.Register<string>(this,OnReceive);

			WeakReferenceMessenger.Default.Register<string,string>(this,"huiyuan", OnReceive);
		}
		private void OnReceive(object recipient,object message)
		{
			MessageBox.Show(message.ToString());
		}
    }
}